/*
 * @Author: huzhanglin 799490931@qq.com
 * @Date: 2022-05-29 10:33:52
 * @LastEditors: huzhanglin 799490931@qq.com
 * @LastEditTime: 2022-05-30 10:05:29
 * @FilePath: \vue-next-admin\src\api\login\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from "/@/utils/request";

/**
 * 手機號登錄
 */
export interface PhoneNumberLoginForm{
	phoneNumber: String,
	smsCode: string | number | undefined,
	userName:String,
}
export interface  Loading{
	signIn:boolean
}

export interface PhoneNumberLoginState {
	phoneNumberLoginForm:PhoneNumberLoginForm,
	loading:Loading
}

/**
 * 登录api接口集合
 * @method signIn 用户登录
 * @method signOut 用户退出登录
 */
export function userLoginApi() {
	return {
		signIn: (params: object) => {
			return request({
				url: '/user/signIn',
				method: 'post',
				data: params,
			});
		},
		signOut: (params: object) => {
			return request({
				url: '/user/signOut',
				method: 'post',
				data: params,
			});
		},
		//发送验证码
		smsCode:(phoneNumber:String) =>{
			return request({
				url: '/smscode?mobile='+phoneNumber,
				method: 'get'
			});
		},
	// 短信验证码登陆
		smsLogin:(params: object) =>{
			return request({
				url: '/sms/login',
				method: 'post',
				data: params,
			});
		},


	};
}
